local addonName, addon = ...
-- #####################################################################################################################
local frameName = "聊天";
local subFrame = CreateFrame("Frame", frameName, nil, InterfaceOptionsFramePanelContainer, nil)
subFrame:Hide();
-- #####################################################################################################################
local category, layout = addon:InterfaceOptions_AddSubCategory(subFrame, subFrame:GetName())
-- #####################################################################################################################
subFrame:RegisterEvent("ADDON_LOADED")
subFrame:SetScript("OnEvent", function(self, event, loadedAddon)
    if event == "ADDON_LOADED" and loadedAddon == addonName then
        self:UnregisterEvent("ADDON_LOADED")
    end
end)
-- #####################################################################################################################
subFrame:SetScript("OnShow", function(frame)
    --------------------------------------------------------------------------------------------------------------------------
    local title = subFrame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge")
    title:SetPoint("TOPLEFT", 16, -16)
    title:SetText("聊天框设置")
    --------------------------------------------------------------------------------------------------------------------------
    local bigFootChannel = addon:newCheckbox(subFrame, "加入【大脚魔兽世界频道】", "加入【大脚魔兽世界频道】", function(self, value)
        -- /join 大脚魔兽世界频道
    end)
    bigFootChannel:SetPoint("TOPLEFT", title, "BOTTOMLEFT", -2, -16)
    bigFootChannel:SetChecked(true)
    --------------------------------------------------------------------------------------------------------------------------
    local apiChannel = addon:newCheckbox(subFrame, "测试聊天API", "测试聊天API", function(self, value)
        local player = UnitName("player")
        local player2 = GetUnitName("player", true)
        -- SendChatMessage("text" [, "chatType" [, languageIndex [, "channel"]]])
        SendChatMessage("Hey " .. player .. " I'm sended msg to myself!!!", "WHISPER", nil, player)
        SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "CHANNEL", nil, 1)
        SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "CHANNEL", nil, 2)
        SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "SAY")
        SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "YELL")
        SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "GUILD")
        SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(22691)), "GUILD")

        ChatFrame1:AddMessage("这是我要说的话....1")
        ChatFrame2:AddMessage("这是我要说的话....2")
        ChatFrame3:AddMessage("这是我要说的话....3")
        ChatFrame4:AddMessage("这是我要说的话....4")
        ChatFrame5:AddMessage("这是我要说的话....5")
        ChatFrame6:AddMessage("这是我要说的话....6")
        ChatFrame7:AddMessage("这是我要说的话....7")
        ChatFrame8:AddMessage("这是我要说的话....8")
        ChatFrame9:AddMessage("这是我要说的话....9")
    end)
    apiChannel:SetPoint("TOPLEFT", bigFootChannel, "BOTTOMLEFT", -2, -16)
    --------------------------------------------------------------------------------------------------------------------------
end)
-- #####################################################################################################################
--- SendChatMessage("text" [, "chatType" [, languageIndex [, "channel"]]])
--- chatType:
--- SAY:默认 /s
--- CHANNEL: /1 /2
--- DND:
--- EMOTE:
--- GUILD: 工会 /g
--- INSTANCE_CHAT:
--- OFFICER: /o
--- PARTY:  /p
--- RAID:  /ra
--- RAID_WARNING:  /rw
--- WHISPER:  /w 密语
--- YELL:  /y 大喊
--SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "CHANNEL", nil, 1)
--SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "CHANNEL", nil, 2)
--SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "SAY")
--SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "YELL")
--SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(52)), "GUILD")
--SendChatMessage("测试API-Chat+Item:" .. select(2, GetItemInfo(22691)), "GUILD")
-- #####################################################################################################################
-- #####################################################################################################################